package com.xuecheng.test.demo.demo;

import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class demo03 {
    public static void main(String[] args) throws Exception {
        demo03 demo03 = new demo03();


        demo03.demo4();
        //demo03.demo3();


/*      String num = "[12-55]";
        String[] strings = num.split("-");

        if(strings.length==2){
            if (num.contains("[")){
                System.out.println("包含");
            }
            if (num.contains("(")){
                System.out.println("不包含");
            }
            String startNumber = strings[0].replace("[","").replace("(","");
            String endNumber= strings[1].replace("]","").replace(")","");
            System.out.println(startNumber +"***" +endNumber);
        }
*/

    }

    public void demo1(){
            String number = "0.5616";
            Pattern pattern = Pattern.compile("^-?\\d{1,14}\\.{1}\\d{1,6}$|-?\\d{1,14}$");
            Matcher isNum = pattern.matcher(number);
            if( !isNum.matches() )number = null;
            System.out.println(number);
    }

    public void demo2(){
        String number = "[-10.0~10.0]";
        Pattern pattern = Pattern.compile("^\\(-?\\d{1,11}\\.{1}\\d{1,2}~-?\\d{1,11}\\.{1}\\d{1,2}\\)$|\\[-?\\d{1,11}\\.{1}\\d{1,2}~-?\\d{1,11}\\.{1}\\d{1,2}\\]$|\\(-?\\d{1,11}~-?\\d{1,11}\\)$|\\[-?\\d{1,11}~-?\\d{1,11}\\]$" + //这一行是只能输入[带小数点] ，[不带小数点]，(带小数点)，(不带小数点)
                        "\\(-?\\d{1,11}~-?\\d{1,11}\\.{1}\\d{1,2}\\)$|\\[-?\\d{1,11}~-?\\d{1,11}\\.{1}\\d{1,2}\\]$|\\(-?\\d{1,11}\\.{1}\\d{1,2}~-?\\d{1,11}\\)$|\\[-?\\d{1,11}\\.{1}\\d{1,2}~-?\\d{1,11}\\]$");
        Matcher isNum = pattern.matcher(number);
        System.out.println(isNum);
        if( !isNum.matches() )number = null;
        System.out.println(number);
    }

    public void demo3(){
        float a = 12;
        int b = 5;
        //float bc =  b;
        Integer num = (int)Math.ceil(a/b);
        System.out.println(num);
    }

    public void demo4(){
        String uuid = UUID.randomUUID().toString();
        System.out.println(uuid.replace("-",""));
    }
}
